package facilius.controller.actionmanager;

import facilius.controller.ActionManager;
import facilius.controller.action.material.MaterialCreateAction;
import facilius.controller.action.material.MaterialShowFormAction;
import org.mentawai.authorization.Permission;
import org.mentawai.core.ActionConfig;
import org.mentawai.core.ApplicationManager;
import org.mentawai.core.Forward;
import org.mentawai.core.Redirect;
import org.mentawai.filter.AuthorizationFilter;
import org.mentawai.filter.FileUploadFilter;

/**
 *
 * @author Graciano
 */
public class MaterialActionManager implements ActionManager{

    public void loadActions(ApplicationManager appManager) {
        ActionConfig ac = null;

        ac = new ActionConfig("MaterialCreate", MaterialCreateAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("AulaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new FileUploadFilter());
        appManager.addActionConfig(ac);

        ac = new ActionConfig("MaterialShowForm", MaterialShowFormAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/material/materialForm.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("MaterialShowFormAluno", MaterialShowFormAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/material/materialFormAluno.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        appManager.addActionConfig(ac);
    }

}
